DXL script to delete requirements in DOORS based on a attribute value

I have a requirement in which I am maintaining a value "Deleted" in a column like "Marked". I want a DXL script which will go through the column "Marked" and delete all the requirements which have "Deleted" keyword in that column.

Please help.
SumitKumarApata - Mon May 30 07:01:08 EDT 2011

Re: DXL script to delete requirements in DOORS based on a attribute value
SystemAdmin - Mon May 30 07:52:23 EDT 2011

Hi Sumit,

Find the script in the attachment.

Open the module in exclusive edit and run this script.

Remember this is a hard delete, you cannot undelete the objects again.

Regards,
Naveen
Attachments

attachment_14622425_delete_Objects_based_on_attribute_value.dxl

Re: DXL script to delete requirements in DOORS based on a attribute value
Tony_Goodman - Tue May 31 08:51:10 EDT 2011

SystemAdmin - Mon May 30 07:52:23 EDT 2011
Hi Sumit,

Find the script in the attachment.

Open the module in exclusive edit and run this script.

Remember this is a hard delete, you cannot undelete the objects again.

Regards,
Naveen

DON'T DO IT!

Reasons not to use the script:

It does warn about what it is going to do.

It is a bad idea to delete objects in the middle of a for object in loop.
You should place the objects in a skip list first, then loop through the skip list.

Use of the delete() function is no longer recommended. Use softDelete().

Never purge (hard delete) objects just like that. Soft-delete, baseline, then purge if you are sure.

Tony Goodman www.smartdxl.com

Re: DXL script to delete requirements in DOORS based on a attribute value
llandale - Tue May 31 14:45:09 EDT 2011

Tony_Goodman - Tue May 31 08:51:10 EDT 2011
DON'T DO IT!

Reasons not to use the script:

It does warn about what it is going to do.

It is a bad idea to delete objects in the middle of a for object in loop.
You should place the objects in a skip list first, then loop through the skip list.

Use of the delete() function is no longer recommended. Use softDelete().

Never purge (hard delete) objects just like that. Soft-delete, baseline, then purge if you are sure.

Tony Goodman www.smartdxl.com

At least I wasn't the only one with the HeeBeeJeeBees with that script.

use "hardDelete" instead of "delete", easier to understand. In fact, I'd be tempted two write a quick "purge(obj)" function that simply calls hardDelete, just to make it crystal clear.
don't forget to "flushDeletions".
don't forget you cannot "hardDelete" an already "softDeleted" object:
.. if (isDeleted(obj)) undelete(obj)
.. hardDelete(obj)
don't forget to trap errors:
.. noError()
.. hardDelete(obj)
.. ErrMess = lastError()
.. if (!null ErrMess) then report the error
don't forget to save the module ... I suppose

  • Louie

Re: DXL script to delete requirements in DOORS based on a attribute value
SumitKumarApata - Tue May 31 21:40:20 EDT 2011

llandale - Tue May 31 14:45:09 EDT 2011
At least I wasn't the only one with the HeeBeeJeeBees with that script.

use "hardDelete" instead of "delete", easier to understand. In fact, I'd be tempted two write a quick "purge(obj)" function that simply calls hardDelete, just to make it crystal clear.
don't forget to "flushDeletions".
don't forget you cannot "hardDelete" an already "softDeleted" object:
.. if (isDeleted(obj)) undelete(obj)
.. hardDelete(obj)
don't forget to trap errors:
.. noError()
.. hardDelete(obj)
.. ErrMess = lastError()
.. if (!null ErrMess) then report the error
don't forget to save the module ... I suppose

  • Louie

Thanks for the useful tips. Can someone please share the DXL script taking into account all these guidelines/best practices.